Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: data race in pkg cri/stream #1925

Merged
merged 1 commit into from
Aug 2, 2018

Conversation

YaoZengzeng
Copy link
Contributor

Signed-off-by: YaoZengzeng [email protected]

Ⅰ. Describe what this PR did

There is an data race in pkg cri/stream when I build pouchd with flag -race and use cri-tools to test the stream server related api:

Read
cri/stream/portforward.(*httpStreamHandler).monitorStreamPair()
cri/stream/portforward/httpstream.go:135

Previous write
cri/stream/httpstream/spdy.(*connection).registerStream()
cri/stream/httpstream/spdy/connection.go:97

%v will read the underlying structure which is the source of the data race

we should use the %p to avoid it.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@pouchrobot pouchrobot added kind/bug This is bug report for project size/XS labels Jul 30, 2018
@fuweid fuweid self-assigned this Jul 30, 2018
@codecov-io
Copy link

codecov-io commented Jul 30, 2018

Codecov Report

Merging #1925 into master will increase coverage by 0.01%.
The diff coverage is 76.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1925      +/-   ##
==========================================
+ Coverage   63.74%   63.75%   +0.01%     
==========================================
  Files         200      200              
  Lines       15527    15527              
==========================================
+ Hits         9898     9900       +2     
+ Misses       4396     4394       -2     
  Partials     1233     1233
Flag Coverage Δ
#criv1alpha1test 33.81% <76.92%> (+0.01%) ⬆️
#criv1alpha2test 34.27% <76.92%> (-0.02%) ⬇️
#integrationtest 38.44% <0%> (+0.01%) ⬆️
#unittest 22.01% <ø> (ø) ⬆️
Impacted Files Coverage Δ
cri/stream/portforward/httpstream.go 69.16% <76.92%> (ø) ⬆️
apis/server/utils.go 66.66% <0%> (+4.76%) ⬆️

p.printError(msg)
case <-p.complete:
logrus.Infof("(conn=%v, request=%s) successfully received error and data streams", h.conn, p.requestID)
logrus.Infof("(conn=%p, request=%s) successfully received error and data streams", h.conn, p.requestID)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we update it with address of connection? I don't think the %p can provide useful information here.


if err != nil {
msg := fmt.Sprintf("error forwarding port %d to pod %s: %v", port, h.pod, err)
msg := fmt.Sprintf("PortForward of CRI: error forwarding port %d to pod %s: %v", port, h.pod, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer to use lowercase in the message.

@YaoZengzeng
Copy link
Contributor Author

@fuweid Updated.

Copy link
Contributor

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is bug report for project size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants